﻿<!-- BEGIN MAIN CONTENT -->
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN: ACCORDION DEMO -->
        <div class="portlet light">
            <div class="portlet-title page-bar">
                <ul class="page-breadcrumb pull-right">
                    <li>
                        <i class="fa fa-home"></i>
                        <a href="#/home.html">管理中心</a>
                        <i class="fa fa-angle-right"></i>
                    </li>
                    <li>
                        <a href="#/GgcmsTutorialList.html?ugroup={{currentInfo.selectUserGroup}}">教程管理</a>
                        <i class="fa fa-angle-right"></i>
                    </li>
                    <li>
                        <a href="javascript:;" data-ng-bind="$state.current.data.pageTitle"></a>
                    </li>
                </ul>
                <div class="caption font-green-sharp">
                    <i class="icon-note font-green-sharp"></i>
                    <span class="caption-subject bold uppercase" data-ng-bind="$state.current.data.pageTitle"></span>
                </div>
            </div>
            <div class="portlet-body">
                <div class="row">
                    <div class="col-xs-12">
                        <form class="form-horizontal" name="ggcmsForm" role="form" novalidate>
                            <input type="hidden" ng-model="data.Id">
                            <div class="form-body">
                                <uib-tabset active="active">
                                    <uib-tab heading="基本信息">
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Title.$invalid&&!ggcmsForm.Title.$pristine}">
                                            <label class="col-md-3 control-label">标题:</label>
                                            <div class="col-md-9">
                                                <input type="text" name="Title" minlength="2" maxlength="50" class="form-control" placeholder="请输入教程标题" required ng-model="data.Title">
                                                <div class="help-block" ng-show="ggcmsForm.Title.$invalid&&!ggcmsForm.Title.$pristine"> 请输入教程标题 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.UserGroup.$invalid&&!ggcmsForm.UserGroup.$pristine}">
                                            <label class="col-md-3 control-label">选择用户组:</label>
                                            <div class="col-md-9 pd-t-8">
                                                <input type="hidden" required name="UserGroup" id="UserGroup" ng-model="data.UserGroups">
                                                <label class="mt-checkbox mt-checkbox-outline mt-checkbox-single mg-r-10" ng-repeat="item in currentInfo.UserGroup">
                                                    <input type="checkbox" ng-click="userGroupCheck(item)" class="group-checkable" ng-model="item.checked" /> {{item.Dkey}} <span></span> 
                                                </label>
                                                <div class="help-block" ng-show="ggcmsForm.UserGroup.$invalid&&!ggcmsForm.UserGroup.$pristine"> 请选择用户组 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.btnSelectLogo.$invalid&&!ggcmsForm.btnSelectLogo.$pristine}">
                                            <label class="col-md-3 control-label">标题图片:</label>
                                            <div class="col-md-9">
                                                <input type="text" class="form-control input-medium inline-block" ng-model="data.Thumbnail" name="Thumbnail" id="Thumbnail" placeholder="可以直接填写Url地址" />
                                                <button class="btn blue" type="button" ngf-select="editSvr.fileUpload($file,'Thumbnail',false,0)" ng-model="currentInfo.btnSelectLogo" name="btnSelectLogo" ngf-pattern="'image/*'" ngf-accept="'image/*'" ngf-max-size="200KB"> <i class="fa fa-picture-o"></i> 选择图片 </button>
                                                <button class="btn green" type="button" name="btnPreviewLogo" ng-if="data.Thumbnail" ng-click="editSvr.filePreview('Thumbnail')"> <i class="icon-eye"></i> 预览 </button>
                                                <button class="btn red" type="button" name="btnClearLogo" ng-if="data.Thumbnail" ng-click="editSvr.fileClear('Thumbnail')"> <i class="icon-trash"></i> 清除 </button>
                                                <div class="help-block" ng-show="ggcmsForm.btnSelectLogo.$invalid&&!ggcmsForm.btnSelectLogo.$pristine"> 只能上传小于200kb的图片 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.btnSelectVideo.$invalid&&!ggcmsForm.btnSelectVideo.$pristine}">
                                            <label class="col-md-3 control-label">教程视频:</label>
                                            <div class="col-md-9">
                                                <input type="text" class="form-control input-medium inline-block" ng-model="data.VideoUrl" name="VideoUrl" id="VideoUrl" placeholder="可以直接填写Url地址" />
                                                <button class="btn blue" type="button" ngf-select="editSvr.fileUpload($file,'VideoUrl',false,0)" ng-model="currentInfo.btnSelectVideo" name="btnSelectVideo" ngf-pattern="'video/*'"> <i class="fa fa-youtube-play"></i> 选择视频 </button>
                                                <button class="btn green" type="button" name="btnPreviewVideo" ng-if="data.VideoUrl" ng-click="editSvr.filePreview('VideoUrl')"> <i class="icon-eye"></i> 预览 </button>
                                                <button class="btn red" type="button" name="btnClearVideo" ng-if="data.VideoUrl" ng-click="editSvr.fileClear('VideoUrl')"> <i class="icon-trash"></i> 清除 </button>
                                                <div class="help-block" ng-show="ggcmsForm.btnSelectVideo.$invalid&&!ggcmsForm.btnSelectVideo.$pristine"> 只能上传视频文件 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Content.$invalid&&!ggcmsForm.Content.$pristine}">
                                            <label class="col-md-3 control-label">内容:</label>
                                            <div class="col-md-9">
                                                <summernote config="editoptions" id="Content" name="Content" class="form-control" placeholder="文章内容" ng-model="data.Content" on-image-upload="editSvr.imagesUpload(files,'Content')" on-media-delete="editSvr.fileClear(target)"></summernote>
                                                <div class="help-block" ng-show="ggcmsForm.Content.$invalid&&!ggcmsForm.Content.$pristine"> 文章内容不能为空 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Description.$invalid&&!ggcmsForm.Description.$pristine}">
                                            <label class="col-md-3 control-label">内容摘要:</label>
                                            <div class="col-md-9">
                                                <textarea name="Description" id="Description" maxlength="255" rows="4" class="form-control" placeholder="内容摘要" ng-model="data.Description"></textarea>
                                                <div class="help-block" ng-show="ggcmsForm.Description.$invalid&&!ggcmsForm.Description.$pristine"> 内容摘要 </div>
                                            </div>
                                        </div>
                                    </uib-tab>

                                    <uib-tab heading="附件上传">
                                        <div class="clearfix mg-b-20">
                                            <button class="btn green-haze btn-outline sbold uppercase" ng-click="editSvr.attaAdd()"> <i class="fa fa-plus"></i> 添加附件 </button>
                                        </div>
                                        <div class="alert alert-danger"> <i class="fa fa-exclamation-triangle"></i> 为方便展示，请正确选择附件类型。 </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.{{item.btnName}}.$invalid&&!ggcmsForm.{{item.btnName}}.$pristine}" ng-repeat="item in data.AttaList| filter:{AttaType:'!-1'} | orderBy:'Sortid'">
                                            <div class="col-sm-2">
                                                <select class="form-control" name="FileType" id="FileType" ng-model="item.FileType" ng-options="kv.type as kv.name for kv in sysDicts.fileType"></select>
                                            </div>
                                            <div class="col-sm-2">
                                                <input type="text" name="atta_{{item.nid}}" id="atta_{{item.nid}}" maxlength="30" class="form-control" placeholder="请填写视频说明" ng-model="item.Info">
                                            </div>
                                            <div class="col-sm-2">
                                                <input type="text" name="attaurl_{{item.nid}}" id="attaurl_{{item.nid}}" maxlength="255" class="form-control" placeholder="可以直接填写Url地址" ng-model="item.Attaurl">
                                            </div>
                                            <div class="col-sm-2">
                                                <div class="clearfix">
                                                    <div class="btn-group btn-group-justified">
                                                        <a href="javascript:;" class="btn blue btn-outline" ng-if="item.Sortid>1" ng-click="editSvr.attrUpDown(item,-1.5)"> <i class="fa fa-angle-double-up"></i> </a>
                                                        <a href="javascript:;" class="btn blue btn-outline" ng-if="item.Sortid<editSvr.attrCount()" ng-click="editSvr.attrUpDown(item,1.5)"> <i class="fa fa-angle-double-down"></i> </a>
                                                        <a href="javascript:;" class="btn red btn-outline" ng-click="editSvr.attrDelete(item)"> <i class="fa fa-times"></i> </a>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-sm-4">
                                                <button class="btn blue" type="button" ngf-select="editSvr.fileUpload($file,item,false,0)" ng-model="item.file" name="{{item.btnName}}" ngf-max-size="2MB"> <i class="fa fa-paperclip"></i> 选择文件 </button>
                                                <button class="btn green" type="button" name="{{item.btnName}}Preview" ng-if="item.FileType.indexOf('image')==0" ng-click="editSvr.filePreview(item)"> <i class="icon-eye"></i> 预览 </button>
                                                <button class="btn red" type="button" name="{{item.btnName}}Clear" ng-if="item.Attaurl" ng-click="editSvr.fileClear(item)"> <i class="icon-trash"></i> 清除 </button>
                                                <div class="help-block" ng-show="ggcmsForm.{{item.btnName}}.$invalid&&!ggcmsForm.{{item.btnName}}.$pristine"> 文件必须小于2M </div>
                                            </div>
                                        </div>
                                    </uib-tab>
                                </uib-tabset>
                            </div>
                            <div class="form-actions">
                                <hr/>
                                <div class="row">
                                    <div class="col-md-12 text-center">
                                        <button class="btn green" ng-click="saveData(data)" ng-disabled="ggcmsForm.$invalid||saveing"> <span class="fa fa-save"></span> 保存</button>
                                    </div>
                                </div>
                            </div>
                        </form>

                    </div>
                </div>
            </div>
        </div>
        <!-- END: ACCORDION DEMO -->
    </div>
</div>
<!-- END MAIN CONTENT -->
<pic-pre-view url="currentInfo.pic" close="editSvr.previewClose()" ng-if="currentInfo.picShow"></pic-pre-view>